package utils.test;

import net.HttpRequest;
import net.sf.json.JSONObject;

public class CreateModelAndStartTask {
    public static void main(String[] args) {
        String json = "{\n" +
                "    \"taskNumber\": 2,\n" +
                "    \"name\": \"test name\",\n" +
                "    \"lines\": [\n" +
                "      {\n" +
                "          \"pageSourceId\": \"uiStart_1\",\n" +
                "          \"pageTargetId\": \"uiAlgorithm_1\"\n" +
                "      },\n" +
                "      {\n" +
                "          \"pageSourceId\": \"uiAlgorithm_1\",\n" +
                "          \"pageTargetId\": \"uiAlgorithm_2\"\n" +
                "      },\n" +
                "      {\n" +
                "          \"pageSourceId\": \"uiAlgorithm_2\",\n" +
                "          \"pageTargetId\": \"uiAlgorithm_3\"\n" +
                "      },\n" +
                "      {\n" +
                "          \"pageSourceId\": \"uiData_1\",\n" +
                "          \"pageTargetId\": \"uiAlgorithm_2\"\n" +
                "      },\n" +
                "      {\n" +
                "          \"pageSourceId\": \"uiAlgorithm_3\",\n" +
                "          \"pageTargetId\": \"uiAlgorithm_4\"\n" +
                "      },\n" +
                "      {\n" +
                "          \"pageSourceId\": \"uiAlgorithm_4\",\n" +
                "          \"pageTargetId\": \"uiAlgorithm_5\"\n" +
                "      },\n" +
                "      {\n" +
                "          \"pageSourceId\": \"uiAlgorithm_5\",\n" +
                "          \"pageTargetId\": \"uiAlgorithm_6\"\n" +
                "      },\n" +
                "      {\n" +
                "          \"pageSourceId\": \"uiAlgorithm_6\",\n" +
                "          \"pageTargetId\": \"uiEnd_1\"\n" +
                "      }\n" +
                "  ],\n" +
                "    \"blocks\": [\n" +
                "      {\n" +
                "          \"dataId\": \"378\",\n" +
                "          \"blockId\": \"uiAlgorithm_1\",\n" +
                "          \"paramsConfigDefault\": [\n" +
                "              {\n" +
                "                  \"paramName\": \"a\",\n" +
                "                  \"paramValue\": \"1\",\n" +
                "                  \"type\": \"int\",\n" +
                "                  \"desc\": \"参数1\"\n" +
                "              },\n" +
                "              {\n" +
                "                  \"paramName\": \"b\",\n" +
                "                  \"paramValue\": \"1\",\n" +
                "                  \"type\": \"float\",\n" +
                "                  \"desc\": \"参数2\"\n" +
                "              }\n" +
                "          ]\n" +
                "      },\n" +
                "      {\n" +
                "          \"dataId\": \"378\",\n" +
                "          \"blockId\": \"uiAlgorithm_2\",\n" +
                "          \"inputConfig\": [\n" +
                "              {\n" +
                "                  \"inputName\": \"-i1\",\n" +
                "                  \"frontOutput\": {\n" +
                "                      \"frontOutputName\": \"-o1\",\n" +
                "                      \"blockId\": \"uiAlgorithm_1\",\n" +
                "                      \"dataId\": \"378\"\n" +
                "                  }\n" +
                "              },\n" +
                "              {\n" +
                "                  \"inputName\": \"-i2\",\n" +
                "                  \"frontOutput\": {\n" +
                "                      \"frontOutputName\": \"+uiData_1+1\",\n" +
                "                      \"blockId\": \"uiData_1\",\n" +
                "                      \"dataId\": \"\"\n" +
                "                  }\n" +
                "              }\n" +
                "          ],\n" +
                "          \"paramsConfigDefault\": [\n" +
                "              {\n" +
                "                  \"paramName\": \"a\",\n" +
                "                  \"paramValue\": \"1\",\n" +
                "                  \"type\": \"int\",\n" +
                "                  \"desc\": \"参数1\"\n" +
                "              },\n" +
                "              {\n" +
                "                  \"paramName\": \"b\",\n" +
                "                  \"paramValue\": \"2\",\n" +
                "                  \"type\": \"float\",\n" +
                "                  \"desc\": \"参数2\"\n" +
                "              }\n" +
                "          ]\n" +
                "      },\n" +
                "      {\n" +
                "          \"dataId\": \"378\",\n" +
                "          \"blockId\": \"uiAlgorithm_3\",\n" +
                "          \"inputConfig\": [\n" +
                "              {\n" +
                "                  \"inputName\": \"-i1\",\n" +
                "                  \"frontOutput\": {\n" +
                "                      \"frontOutputName\": \"-o1\",\n" +
                "                      \"blockId\": \"uiAlgorithm_2\",\n" +
                "                      \"dataId\": \"378\"\n" +
                "                  }\n" +
                "              },\n" +
                "              {\n" +
                "                  \"inputName\": \"-i2\",\n" +
                "                  \"frontOutput\": {\n" +
                "                      \"frontOutputName\": \"-o2\",\n" +
                "                      \"blockId\": \"uiAlgorithm_2\",\n" +
                "                      \"dataId\": \"378\"\n" +
                "                  }\n" +
                "              }\n" +
                "          ],\n" +
                "          \"paramsConfigDefault\": [\n" +
                "              {\n" +
                "                  \"paramName\": \"a\",\n" +
                "                  \"paramValue\": \"1\",\n" +
                "                  \"type\": \"int\",\n" +
                "                  \"desc\": \"参数1\"\n" +
                "              },\n" +
                "              {\n" +
                "                  \"paramName\": \"b\",\n" +
                "                  \"paramValue\": \"2\",\n" +
                "                  \"type\": \"float\",\n" +
                "                  \"desc\": \"参数2\"\n" +
                "              }\n" +
                "          ]\n" +
                "      },\n" +
                "      {\n" +
                "          \"blockId\": \"uiData_1\",\n" +
                "          \"blockName\": \"外部数据源1\"\n" +
                "      },\n" +
                "      {\n" +
                "          \"dataId\": \"378\",\n" +
                "          \"blockId\": \"uiAlgorithm_4\",\n" +
                "          \"inputConfig\": [\n" +
                "              {\n" +
                "                  \"inputName\": \"-i1\",\n" +
                "                  \"frontOutput\": {\n" +
                "                      \"frontOutputName\": \"-o2\",\n" +
                "                      \"blockId\": \"uiAlgorithm_3\",\n" +
                "                      \"dataId\": \"378\"\n" +
                "                  }\n" +
                "              },\n" +
                "              {\n" +
                "                  \"inputName\": \"-i2\",\n" +
                "                  \"frontOutput\": {\n" +
                "                      \"frontOutputName\": \"-o1\",\n" +
                "                      \"blockId\": \"uiAlgorithm_3\",\n" +
                "                      \"dataId\": \"378\"\n" +
                "                  }\n" +
                "              }\n" +
                "          ],\n" +
                "          \"paramsConfigDefault\": [\n" +
                "              {\n" +
                "                  \"paramName\": \"a\",\n" +
                "                  \"paramValue\": \"1\",\n" +
                "                  \"type\": \"int\",\n" +
                "                  \"desc\": \"参数1\"\n" +
                "              },\n" +
                "              {\n" +
                "                  \"paramName\": \"b\",\n" +
                "                  \"paramValue\": \"2\",\n" +
                "                  \"type\": \"float\",\n" +
                "                  \"desc\": \"参数2\"\n" +
                "              }\n" +
                "          ]\n" +
                "      },\n" +
                "      {\n" +
                "          \"dataId\": \"378\",\n" +
                "          \"blockId\": \"uiAlgorithm_5\",\n" +
                "          \"inputConfig\": [\n" +
                "              {\n" +
                "                  \"inputName\": \"-i1\",\n" +
                "                  \"frontOutput\": {\n" +
                "                      \"frontOutputName\": \"-o1\",\n" +
                "                      \"blockId\": \"uiAlgorithm_4\",\n" +
                "                      \"dataId\": \"378\"\n" +
                "                  }\n" +
                "              },\n" +
                "              {\n" +
                "                  \"inputName\": \"-i2\",\n" +
                "                  \"frontOutput\": {\n" +
                "                      \"frontOutputName\": \"-o2\",\n" +
                "                      \"blockId\": \"uiAlgorithm_4\",\n" +
                "                      \"dataId\": \"378\"\n" +
                "                  }\n" +
                "              }\n" +
                "          ],\n" +
                "          \"paramsConfigDefault\": [\n" +
                "              {\n" +
                "                  \"paramName\": \"a\",\n" +
                "                  \"paramValue\": \"1\",\n" +
                "                  \"type\": \"int\",\n" +
                "                  \"desc\": \"参数1\"\n" +
                "              },\n" +
                "              {\n" +
                "                  \"paramName\": \"b\",\n" +
                "                  \"paramValue\": \"2\",\n" +
                "                  \"type\": \"float\",\n" +
                "                  \"desc\": \"参数2\"\n" +
                "              }\n" +
                "          ]\n" +
                "      },\n" +
                "      {\n" +
                "          \"dataId\": \"378\",\n" +
                "          \"blockId\": \"uiAlgorithm_6\",\n" +
                "          \"inputConfig\": [\n" +
                "              {\n" +
                "                  \"inputName\": \"-i1\",\n" +
                "                  \"frontOutput\": {\n" +
                "                      \"frontOutputName\": \"-o1\",\n" +
                "                      \"blockId\": \"uiAlgorithm_5\",\n" +
                "                      \"dataId\": \"378\"\n" +
                "                  }\n" +
                "              },\n" +
                "              {\n" +
                "                  \"inputName\": \"-i2\",\n" +
                "                  \"frontOutput\": {\n" +
                "                      \"frontOutputName\": \"-o2\",\n" +
                "                      \"blockId\": \"uiAlgorithm_5\",\n" +
                "                      \"dataId\": \"378\"\n" +
                "                  }\n" +
                "              }\n" +
                "          ],\n" +
                "          \"paramsConfigDefault\": [\n" +
                "              {\n" +
                "                  \"paramName\": \"a\",\n" +
                "                  \"paramValue\": \"1\",\n" +
                "                  \"type\": \"int\",\n" +
                "                  \"desc\": \"参数1\"\n" +
                "              },\n" +
                "              {\n" +
                "                  \"paramName\": \"b\",\n" +
                "                  \"paramValue\": \"2\",\n" +
                "                  \"type\": \"float\",\n" +
                "                  \"desc\": \"参数2\"\n" +
                "              }\n" +
                "          ]\n" +
                "      }\n" +
                "  ],\n" +
                "    \"params\": {\n" +
                "      \"inputs\":[\n" +
                "        [\n" +
                "            {\n" +
                "                \"blockId\": \"uiAlgorithm_1\",\n" +
                "                \"blockName\": \"01:智慧城市3\",\n" +
                "                \"inputName\": \"-i1\",\n" +
                "                \"frontOutput\": {\n" +
                "                    \"frontOutputName\": \"c/c_b/c_b_b.jpg\",\n" +
                "                    \"blockId\": \"uiStart_1\",\n" +
                "                    \"dataId\": \"\"\n" +
                "                }\n" +
                "            },\n" +
                "            {\n" +
                "                \"blockId\": \"uiAlgorithm_1\",\n" +
                "                \"blockName\": \"01:智慧城市3\",\n" +
                "                \"inputName\": \"-i2\",\n" +
                "                \"frontOutput\": {\n" +
                "                    \"frontOutputName\": \"c/c_b/c_b_b.jpg\",\n" +
                "                    \"blockId\": \"uiStart_1\",\n" +
                "                    \"dataId\": \"\"\n" +
                "                }\n" +
                "            }\n" +
                "        ],\n" +
                "        [\n" +
                "            {\n" +
                "                \"blockId\": \"uiAlgorithm_1\",\n" +
                "                \"blockName\": \"01:智慧城市3\",\n" +
                "                \"inputName\": \"-i1\",\n" +
                "                \"frontOutput\": {\n" +
                "                    \"frontOutputName\": \"c/c_b/c_b_b.jpg\",\n" +
                "                    \"blockId\": \"uiStart_1\",\n" +
                "                    \"dataId\": \"\"\n" +
                "                }\n" +
                "            },\n" +
                "            {\n" +
                "                \"blockId\": \"uiAlgorithm_1\",\n" +
                "                \"blockName\": \"01:智慧城市3\",\n" +
                "                \"inputName\": \"-i2\",\n" +
                "                \"frontOutput\": {\n" +
                "                    \"frontOutputName\": \"c/c_b/c_b_a.jpg\",\n" +
                "                    \"blockId\": \"uiStart_1\",\n" +
                "                    \"dataId\": \"\"\n" +
                "                }\n" +
                "            }\n" +
                "        ]\n" +
                "    ],\n" +
                "      \"outputs\": [\n" +
                "        [\n" +
                "            {\n" +
                "                \"blockId\": \"uiAlgorithm_6\",\n" +
                "                \"blockName\": \"06:智慧城市3\",\n" +
                "                \"outputName\": \"-o1\",\n" +
                "                \"outputAddress\": \"b/\",\n" +
                "                \"outputValue\": \".txt\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"blockId\": \"uiAlgorithm_6\",\n" +
                "                \"blockName\": \"06:智慧城市3\",\n" +
                "                \"outputName\": \"-o2\",\n" +
                "                \"outputAddress\": \"\",\n" +
                "                \"outputValue\": \"2342\"\n" +
                "            }\n" +
                "        ],\n" +
                "        [\n" +
                "            {\n" +
                "                \"blockId\": \"uiAlgorithm_6\",\n" +
                "                \"blockName\": \"06:智慧城市3\",\n" +
                "                \"outputName\": \"-o1\",\n" +
                "                \"outputAddress\": \"b/\",\n" +
                "                \"outputValue\": \".txt\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"blockId\": \"uiAlgorithm_6\",\n" +
                "                \"blockName\": \"06:智慧城市3\",\n" +
                "                \"outputName\": \"-o2\",\n" +
                "                \"outputAddress\": \"\",\n" +
                "                \"outputValue\": \"2342\"\n" +
                "            }\n" +
                "        ]\n" +
                "    ],\n" +
                "      \"data\": [\n" +
                "        [\n" +
                "            {\n" +
                "                \"dataBlockName\": \"外部数据源1\",\n" +
                "                \"dataName\": \"+uiData_1+1\",\n" +
                "                \"dataValue\": \"c/c_b/c_b_a.jpg\"\n" +
                "            }\n" +
                "        ],\n" +
                "        [\n" +
                "            {\n" +
                "                \"dataBlockName\": \"外部数据源1\",\n" +
                "                \"dataName\": \"+uiData_1+1\",\n" +
                "                \"dataValue\": \"c/c_b/c_b_a.jpg\"\n" +
                "            }\n" +
                "        ]\n" +
                "    ],\n" +
                "      \"other\": [\n" +
                "        {\n" +
                "            \"Priority\": \"50\",\n" +
                "            \"ParallelStrategy\": \"ut\"\n" +
                "        }\n" +
                "    ]\n" +
                "    }\n" +
                "  }\n";
        JSONObject aaa = JSONObject.fromObject(json);
        System.out.println(aaa.toString());
        String result = HttpRequest.sendPost("http://localhost:8080/JCPT/ws/task/no_model_start","data="+json);
        System.out.println(result);
    }
}
